home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8416 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: news.unt.edu!news
  2. From: Steve Fogoros <sfogoros@hsc.unt.edu>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Programming Question
  5. Date: Sun, 03 Mar 1996 22:04:59 -0800
  6. Organization: University of North Texas Health Science Center
  7. Message-ID: <313A880B.1B49@hsc.unt.edu>
  8. References: <1996Mar3.164754.137341@forest>
  9. NNTP-Posting-Host: sfogoros.hsc.unt.edu
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (Win16; I)
  14.  
  15. ebromber@forest.drew.edu wrote:
  16. > Below is part of the code for a password program which I wrote. However,
  17. > wheneve I run the program, the "ENTER PASSWORD HERE" only appears after a
  18. > carriage return is entered. In other words, I have to type the password in
  19. > before it prints that message. If I hit return, it accepts that as the
  20. > password. I wrote this program on a pc and used a MS-DOS compiler. Does
  21. > anyone know why and how I can fix this?
  22. > Thanks in advance.
  23. > ebromber@drew.edu
  24. > PARTIAL CODE
  25. >         int pass[100];
  26. >         int count=0;
  27. >         char ch;
  28. >         printf("ENTER PASSWORD HERE: ");
  29. >         while (ch=getch() !='\n')
  30. >         { pass[count]=ch;
  31. >           putch('*');
  32. >           count++;
  33. >         }
  34.  
  35. I couldn't duplicate using Borland 3.1. You might try fflush(stdout) after printf("Enter ...).
  36.  
  37. -- 
  38. Steve Fogoros, Academic Information Coordinator
  39. University of North Texas Health Science Center
  40. sfogoros@hsc.unt.edu
  41.